﻿

-- =============================================
-- Author:		<Author,XFL>
-- Create date: <Create Date,20120116>
-- Description:	<Description,获取该部门以及其子部门
-- 通过部门id 获取对应子部门 更改为 bmbh 获取>
-- =============================================
CREATE PROCEDURE [dbo].[proc_Wage_Getlist_Dep_Search]
(	
	@DepId int,
	@CompanyId int
)
AS
BEGIN
	/*Departments*/
		declare @bmbh_T  varchar(50)
		set @bmbh_T = (select bmbh  FROM department WHERE id=@DepId)
select 
		[Id]
      ,[DName]
      ,[CompanyId]
      ,[bmbh]
FROM department
Where (@DepId=0 or bmbh like ''+@bmbh_T+'%') and  CompanyId=@CompanyId and bmbh is not null
order by bmbh 

END


